﻿/// <reference path="../../jquery/jquery-1.3.2-vsdoc.js" />
/// <reference path="../Complaint.Namespaces.js" />
/// <reference path="../Complaint.Common.js" />

$(function() {
    $("#addDialog").dialog(
            {
                autoOpen: false,
                bgiframe: true,
                modal: true,
                width: 400,
                buttons:
                {
                    "OK": function() {
                        $.post(
                            Complaint.Common.AdminRoot + "/Category/Add",
                            {
                                parentID: 0,
                                Title: $("#Title").attr("value"),
                                Status: "True"
                            },
                            function(data) {
                                $("#grid").html(data);
                            }
                        );
                        $(this).dialog("close");
                    }
                }
            });

    $("#add").click(function(evt) {
        $("#addDialog").load(Complaint.Common.AdminRoot + "/Category/Add", null,
                    function() {
                        $("#addDialog").dialog("open");
                    });
    });

    $("#expand").click(function(evt) {
        $.tree_reference("categoryTree").open_all();
    });

    $("#collapse").click(function(evt) {
        $.tree_reference("categoryTree").close_all();
    });

});

function AnimateMessage() {
    $("#msg").text("Successfully deleted.");
    $("#msg").animate({ fontSize: "1.5em" }, 400);
    $("#msg").fadeOut("slow");
}